package com.alan.camunda.boot.service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * 配合 HandlerChoose 做选人控制
 * 保存预先指定的处理人
 */
public class TempUserHolder {

    private static final ThreadLocal<List<String>> userHolder = new ThreadLocal<>();

    public static void setTempUsers(List<String> users) {
        userHolder.set(users);
    }

    public static boolean hasTempUsers() {
        return userHolder.get() != null;
    }

    public static List<String> getTempUsers() {
        if (userHolder.get() == null) {
            return Collections.EMPTY_LIST;
        } else {
            return userHolder.get();
        }
    }

    public static void clear() {
        userHolder.remove();
    }



}
